<!DOCTYPE HTML>
<html>

<head>
  <title>How things are made</title>
  <meta name="description" content="website description" />
  <meta name="keywords" content="website keywords, website keywords" />
  <meta http-equiv="content-type" content="text/html; charset=windows-1252" />
  <link rel="stylesheet" type="text/css" href="style/style.css" title="style" />
</head>
<?php


if($_POST['submitted'])
{
		
		
		$fname = $_REQUEST['fname'];
		$lname = $_REQUEST['lname'];
		$email = $_REQUEST['email'];
		$password = $_REQUEST['password'];
		$gender = $_REQUEST['gender'];
		$city = 'Singapore';
		$country = 'Singapore';
		$about_user = $_REQUEST['about_user'];
		$user_type = 'admin';
		
		
		DEFINE ('DB_USER', 'root');
		DEFINE ('DB_PASSWORD', '');
		DEFINE ('DB_HOST', 'localhost');
		DEFINE ('DB_NAME', 'SITEDATABASE');
	
		// Make the connection:
		$dbc = @mysqli_connect (DB_HOST, DB_USER,DB_PASSWORD, DB_NAME) 
		OR die ('Could not connect to MySQL: ' .mysqli_connect_error());
		
		
		 $q = "INSERT INTO users (fname,lname, email, password,gender,city,country,about_user,user_type,registrationtime) VALUES ('$fname','$lname','$email',SHA1('$password'),'$gender','$city','$country','$about_user','$user_type', NOW() )";


$r = @mysqli_query ($dbc, $q); // Run the query.
	if ($r)
	{
		header("Location: http://localhost/MyBlog/login.php");
		echo "User Registration successful";
		echo "<br>";
	}
	else
	{
		echo "User registration unsuccessful";
		echo "<br>";
	}


}

		

?>
<body>
      <div id="header">
      <div id="logo">
        <div id="logo_text">
          <!-- class="logo_colour", allows you to change the colour of the text -->
          <h1><a href="index.php">how things are<span class="logo_colour">Made</span></a></h1>
          <h2>Simple.Different.Creative.</h2>
          </div> 
          
         </div>
      <div id="menubar">
        <ul id="menu">
          <!-- put class="selected" in the li tag for the selected page - to highlight which page you're on -->
          <!--
          <li class="selected"><a href="index.php">Home</a></li>
          <li><a href="addarticle.php">Add Posts</a></li>
          <li><a href="searcharticle.php">Search Posts</a></li>
          <li><a href="searchuser.php">Search User</a></li>
          <li><a href="sendEmail.php">Contact Us</a></li>
          -->
        </ul>
      </div>
    </div>
    <div id="site_content">
      <div class="sidebar">
        <!-- insert your sidebar items here -->
        <!--
        <h3>Latest User</h3>
		<h4>Click to see the user registered details</h4>
        <h5></h5>
        <p>
        
        </p>
        <p></p>
        <h4>Sponsored Links</h4>
        <h5></h5>
        <p>This space is reserved for 5 advertisement links</p>
        <h3>Social Media Links</h3>
        <ul>
          <div class="footer_text">
         <div class="foot_pad">
          <div class="link1"><a href="http://www.facebook.com/pages/How-Things-Are-Made/377142059843?sk=wall"> Be a fan on Facebook</a></div>
          <div class="link2"><a href="#">Follow us on Twitter</a></div>
          
          </div>
          </div>
        </ul>
        -->
      </div>
      <div id="content">
        <!-- insert the page content here -->
       
 <form action="http://localhost/MyBlog/registration.php" method="post">
<p>First Name : <input type="text" name="fname" size="20" maxlength="20" value="" /></p>
<p>Last Name : <input type="text" name="lname" size="20" maxlength="20" value="" /></p>
<p>E-mail :<input type="text" name="email" size="20" maxlength="60" value="" /></p>
<p>Password : <input type="password" name="password" size="25" maxlength="25" /></p>
<p>Confirm Password : <input type="password" name="password1"size="25" maxlength="25" /></p>

<p><b>Gender:</b> 
<input type="radio" name="gender" value="Male" /> Male 
<input type="radio" name="gender" value="Female" />Female</p>

<p><b>About Yourself:</b>
 <textarea name="about_user" rows="3" cols="40"></textarea>
 </p>

<p><input type="submit" name= "submit" value="Submit" />
   <input type="hidden" name="submitted" value="1" />
   <input type="reset" name="reset" value="reset" /></p>
   
</form>
   
      </div>
    </div>
    <div id="content_footer"></div>
    <div id="footer">
      Copyright &copy; 2011 | howthingsaremade.com <a href=" ></a> | <a href="" ></a> | <a href=" ></a>
    </div>
  </div>
<div style="text-align: center; font-size: 0.75em;">  <a href="	http://facebook.com/howthingaremade.com"> Designed for E-Business</a>.</div></body>
</html>
